/***************************************************************************
 *   Copyright (C) 2009 by Kbranch                                         *
 *   kbranch@andLinux                                                      *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/

#define NUMSTATS 17
#define NUMMODS 6

typedef long long int int64;

enum { STR, AGI, AP, BASESTR, BASEAGI, BASEAP, CRITPERCENT, HITPERCENT, EXPERTISEPERCENT, HASTERATING, ARPENRATING, HITRATING, EXPERTISERATING, CRITRATING, WEAPONAP, WEAPONDAMAGE, HIGHESTSTAT };
enum { HASTEMOD, APMOD, STATMOD, DAMAGEMOD, BLEEDDAMAGEMOD, ARPENMOD };

struct RatingsConstants
{
	double ratingPerHaste;
	double ratingPerArPen;
	double ratingPerCrit;
	double ratingPerHit;
	double ratingPerExpertise;
	double agiPerCrit;
};

class Stats
{
	public:
		Stats();
		Stats(double newStats[], double newMods[], int statsLength, int modsLength, int newBaseMissChance, int newBaseDodgeChance, int64 newBaseAttackSpeed);
		
		Stats& operator=(const Stats &rightSide);
		Stats& operator+=(const Stats &rightSide);
		Stats& operator-=(const Stats &rightSide);
		const Stats operator+(const Stats &rightSide) const;
		const Stats operator-(const Stats &rightSide) const;
		bool operator==(const Stats &rightSide) const;
		bool operator!=(const Stats &rightSide) const;
		
		void CalculateStats();
		void CalculateCritChance();
		void CalculateHitChance();
		void CalculateHaste();
		void CalculateArPen();
		void CalculateAll();
		double GetStat(int stat) const;
		double GetModifier(int modifier) const;
		double GetCritChance() const;
		double GetHitChance() const;
		int64 GetAttackSpeed() const;
		double GetGearArPenPercent() const;
		double GetArmorDamageReduction() const;
		void SetStat(int stat, double value);
		void SetModifier(int modifier, double value);
		void SetBaseBossArmor(int newArmor);
		void AddStat(int stat, double value);
		void AddModifier(int modifier, double value);
		void SubtractStat(int stat, double value);
		void SubtractModifier(int modifier, double value);
		
		static const RatingsConstants ratingsConstants;
	
	private:
		double stats[NUMSTATS];
		double modifiers[NUMMODS];
		double critChance;
		double hitChance;
		double baseMissChance;
		double baseDodgeChance;
		int64 attackSpeed;
		int64 baseAttackSpeed;
		int baseBossArmor;
		double gearArPenPercent;
		double armorDamageReduction;
};